<template>
  <div>
    test2
    <span>{{ str }}</span>
    <span>{{ num }}</span>
  </div>

  <el-button type="success" @click="resetStore">重置store</el-button>
  <el-button type="success" @click="changeData">+1</el-button>
  <el-button type="success" @click="toTest2">跳转首页</el-button>

  <Test></Test>
</template>

<script setup lang="ts">
import { useApp } from '@/store/app'

const appStore = useApp()
const { num, str } = storeToRefs(useApp())
console.log(111)

const router = useRouter()

const changeData = () => {
  appStore.addNum()
}
const resetStore = () => {
  appStore.$reset()
}
const toTest2 = () => {
  router.push('/')
}
</script>
